package cn.iocoder.yudao.module.scenic.dal.mysql.spotrelation;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.scenic.controller.admin.spotrelation.vo.SpotRelationPageReqVO;
import cn.iocoder.yudao.module.scenic.dal.dataobject.spotrelation.SpotRelationDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 线路实践点关联 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface SpotRelationMapper extends BaseMapperX<SpotRelationDO> {

    default PageResult<SpotRelationDO> selectPage(SpotRelationPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SpotRelationDO>()
                .eqIfPresent(SpotRelationDO::getRoadId, reqVO.getRoadId())
                .eqIfPresent(SpotRelationDO::getSpotId, reqVO.getSpotId())
                .eqIfPresent(SpotRelationDO::getSpotDeptId, reqVO.getSpotDeptId())
                .betweenIfPresent(SpotRelationDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(SpotRelationDO::getId));
    }

}